/*
 *   This File is Part of CuteOgre Game Engine
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *	Copyright 2010 Alexandre Pires ( c.alexandre.pires@gmail.com )
 *  Created on: 2010/08/22
 */

#ifndef LOGMANAGER_H_
#define LOGMANAGER_H_

#include "IManager.h"
#include "Singleton.h"

#include <QFile>
#include <QTextStream>
#include <QString>

class LogManager :
		public IManager,
		public Singleton<LogManager> {

friend class GameEngine;

private:
	bool mShutdown;
	QFile mFile;
	QTextStream mStream;

protected:
	LogManager ( ) :
		mShutdown ( true ) {
	}

public:
	virtual ~LogManager () {
	}

	static LogManager* getSingletonPtr ( void ) {
		return ms_Singleton;
	}

	static LogManager& getSingleton ( void ) {
		assert( ms_Singleton );
		return ( *ms_Singleton );
	}

	void init ();
	void shutdown ();

	void logException ( const QString& rMessage );
	void logMessage ( const QString& rMessage );

	static void exception ( const QString& rMessage );
	static void message ( const QString& rMessage );
};

#endif /* LOGMANAGER_H_ */
